﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using SimpleTaskSystem;

public class TargetPoint : MonoBehaviour {
    public string operationName;
    Transform player;
    bool activeTarget = false;
	// Use this for initialization
	void Start () {
        player = GameObject.FindGameObjectWithTag("Player").transform;
	}
	
	// Update is called once per frame
	void Update () {
        if (activeTarget)
        {
            if (Vector3.Distance(transform.position,player.position) < 0.7f)
            {
                activeTarget = false;
                OperationMessage.OperationCompleted(operationName);
            }
        }
	}

    public void ActiveTarget()
    {
        activeTarget = true;
    }
}
